package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.server.UserServer;
import com.lagou.rpc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("client")
public class ClientController {

    @Autowired
    UserServer userServer;

    @RequestMapping("getById/{id}")
    public User getUserById(@PathVariable Integer id){
        IUserService iUserService = userServer.getIUserService();
        User user = iUserService.getById(id);
        System.out.println(user.toString());
        return user;
    }
}
